package controller;

import helpers.RealEstateHelper;
import helpers.VnProvincesHelper;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.Province;

/**
 * Servlet implementation class Homepage
 */
public class Home extends HttpServlet {

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		ArrayList<String> typeRealEstate = RealEstateHelper.getTypeRealEstate();
		ArrayList<String> typeService = RealEstateHelper.getTypeService();
		ArrayList<Province> provinces = VnProvincesHelper.getProvinces();
		
		
		
		request.setAttribute("typeRealEstate", typeRealEstate);
		request.setAttribute("typeService", typeService);
		request.setAttribute("provinces", provinces);
		
		try {
			request.getRequestDispatcher("/pages/homepage.jsp").forward(request, response);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
